from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()


if rank % 2 == 0:  # rank is even
    print(f"Hello from process {rank}")
else:
    print(f"Goodbye from process {rank}")
